'''
@Author: frinder6
@Date: 2019-09-25 14:08:58
@LastEditTime: 2019-09-25 14:55:27
@LastEditors: frinder6
@Description: 
'''
import linecache
import re
import time

if __name__ == "__main__":
    tmp_file = open("tmp.txt", "w")
    log_file = "E:/git/learn/AStar-Learning/logs/a-star.log"
    split_key = re.compile(r"2019-08-22 14:18:40")
    lins = linecache.getlines(log_file)
    # 当前时间5分钟之前时间
    # passed_5_min = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() - 5 * 60))
    # print(passed_5_min)
    find_key = False
    for line in lins:
        if not find_key and re.search(split_key, line) is not None:
            find_key = True
        if find_key:
            tmp_file.write(line)
    pass
